package org.zzz.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.zzz.entity.Teacher;
import org.zzz.entity.TeacherVo;
import org.zzz.mapper.TeacherMapper;
import org.zzz.service.TeacherService;
import org.zzz.utils.MybatisUtil;

import java.util.List;

/**
 * @Author ZZF
 * @Time 2021/04/20 22:48
 */
public class TeacherServiceImpl implements TeacherService {

    private TeacherMapper teacherMapper;

    {
//        SqlSession sqlSession = MybatisUtil.getSqlSession();
        teacherMapper = MybatisUtil.getMapper(TeacherMapper.class);
    }

    @Override
    public boolean insertTeacher(Teacher teacher) {
        return teacherMapper.insertTeacher(teacher) > 0;
    }

    @Override
    public List<Teacher> listAllTeacher() {
        return teacherMapper.listAllTeacher();
    }

    @Override
    public Teacher getTeacherById(String id) {
        return teacherMapper.getTeacherById(id);
    }

    @Override
    public List<Teacher> getTeacherByName(String name) {
        return teacherMapper.getTeacherByName(name);
    }
}
